#ifndef __TEXTUREMANAGER_H__
#define __TEXTUREMANAGER_H__
#include <iostream>
#include <map>
#include <SDL.h>
#include <SDL_image.h>

class TextureManager {
    public:
        static TextureManager * Instance(){
            if (s_pInstance == nullptr){
                s_pInstance = new TextureManager();
                return s_pInstance;
            }
            return s_pInstance;
        }

        bool load(std::string fileName,
                  std::string id,
                  SDL_Renderer * pRenderer);
        void draw(std::string id,
                int x, int y,
                int width, int height,
                SDL_Renderer * pRenderer,
                SDL_RendererFlip flip = SDL_FLIP_NONE);
        void drawFrame(std::string id,
                int x, int y,
                int width, int height,
                int currentRow,
                int currentFrame,
                SDL_Renderer * pRenderer,
                double angle, int alpha,
                SDL_RendererFlip flip = SDL_FLIP_NONE);
        void clearFromTextureMap(std::string id);
        void drawTile(
                std::string id,
                int margin, int spacing,
                int x, int y,
                int width, int height,
                int currentRow,
                int currentFrame,
                SDL_Renderer *pRenderer);
    private:
        TextureManager() {};
        static TextureManager * s_pInstance;

    private:
        std::map<std::string, SDL_Texture*> m_textureMap;
};
typedef TextureManager TheTextureManager;
#endif
